// 工程化
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

// 2.创建路由对象并配置路由
const router = new VueRouter({
    routes: [{
            path: '/',
            redirect: { name: 'index' }
        },
        {
            name: 'index',
            path: '/index',
            component: () =>
                import ('@/views/index.vue')
        },
        { //商品列表
            name: 'shoppingList',
            path: '/shoppingList',
            component: () =>
                import ('../views/shoppingList.vue')
        },

        { //购物车
            name: 'car',
            path: '/car',
            component: () =>
                import ('@/views/car.vue')
        },

        {
            name: 'componentsCeil',
            path: '/componentsCeil/:id',
            component: () =>
                import ('../components/componentsCeil.vue')
        },
        {
            name: 'imageList',
            path: '/imageList',
            component: () =>
                import ('../views/imageList.vue')
        },
        {
            path: '/newsList',
            name: 'newsList',
            component: () =>
                import ('@/views/newsList.vue')
        },
        {
            name: 'details',
            path: '/details/:id',
            component: () =>
                import ('@/views/details.vue')
        },
        {
            name: 'commodityInfo',
            path: '/commodityInfo/:id',
            component: () =>
                import ('@/views/commodityInfo.vue')
        },
        {
            name: 'imageDetail',
            path: '/imageDetail/:id',
            component: () =>
                import ('@/views/imageDetail.vue')
        },
        {
            name: 'commentList',
            path: '/commentList/:id',
            component: () =>
                import ('@/views/commentList.vue')
        },
        {
            name: 'NewsDetial',
            path: '/NewsDetial/:id',
            component: () =>
                import ('@/views/NewsDetial.vue')
        }
    ]
})

// 3.暴露
export default router